import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/html")
public class HtmlServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf-8");
        //请求传过来一个query string，里面有一个参数是name，返回的页面里，就有这个name的值，请求的name不同，返回的页面就不同
        String name = req.getParameter("name");
        resp.getWriter().write("<h3>"+name+"</h3>");
    }
}
